package com.gzhryc.net_marketing.cloud.goods.dao;

import java.sql.SQLException;

import com.gzhryc.jdbc.BaseDao;
import com.gzhryc.jdbc.Query;
import com.gzhryc.net_marketing.cloud.goods.dao.db.GoodsSpace;

public class GoodsSpaceDao extends BaseDao<GoodsSpace> {

    public GoodsSpaceDao(String jdbcKey) {
        super(jdbcKey);
    }

    public Long maxIdByGoodsId(Long goodsId) throws SQLException {
        String sql = "SELECT max(id) FROM " +this.tableName+ " WHERE goods_id = ?";
        Query query = new Query(sql);
        query.getParams().setObject(goodsId);
        return this.jdbcHelper.getFirstField(query,Long.class);
    }
}
